@namespace DevToys.Blazor.Components
@inherits StyledComponentBase

<CascadingValue Name="ParentIsEnabled" Value="@IsActuallyEnabled">
    <Container HorizontalAlignment="@HorizontalAlignment"
               VerticalAlignment="@VerticalAlignment"
               Width="@Width"
               Height="@Height"
               MarginLeft="@MarginLeft"
               MarginRight="@MarginRight"
               MarginTop="@MarginTop"
               MarginBottom="@MarginBottom"
               PaddingLeft="@PaddingLeft"
               PaddingRight="@PaddingRight"
               PaddingTop="@PaddingTop"
               PaddingBottom="@PaddingBottom"
               IsEnabled="@IsActuallyEnabled"
               IsVisible="@IsVisible">
        <svg @ref="Element"
             tabindex="-1"
             role="@((IsIndeterminate ? "status" : "progressbar"))"
             width="@(Width.ToPx())"
             height="@(Height.ToPx())"
             class="progress-ring @((IsIndeterminate ? "indeterminate" : string.Empty)) @FinalCssClasses"
             style="@Style"
             viewBox="0 0 16 16"
             @attributes="AdditionalAttributes">
            <circle cx="50%"
                    cy="50%"
                    r="@CircleElementR"
                    stroke-dasharray="3"
                    stroke-dashoffset="@(((100 - Value) / 100) * _circumference)" />
        </svg>
    </Container>
</CascadingValue>